@extends('layouts.home')
@extends('layouts.nav')
@extends('layouts.top')

@section('css')
<link rel="stylesheet" type="text/css" href="{{ asset('files/css/bootstrap-fileupload.min.css') }}" />
@endsection

@section('heading')
    <h3>
        系统设置
    </h3>
    <ul class="breadcrumb">
        <li>
            <a href="#">系统设置</a>
        </li>
        <li class="active"> 广告设置</li>
    </ul>
@endsection


@section('wrapper')
    <section class="panel">

        <div class="panel-body">
            <div class=" form">
                @if(isset($advertisement))
                    <form method="POST" action="{{ route('advertisement.update', $advertisement->id) }}" class="cmxform form-horizontal adminex-form" enctype="multipart/form-data">
                        {{ method_field('PATCH') }}
                @else
                    <form method="POST" action="{{ route('advertisement.store') }}" class="cmxform form-horizontal adminex-form" enctype="multipart/form-data">
                @endif
                    @csrf

                    <div class="form-group last">
                        <label class="control-label col-md-2">上传图片</label>
                        <div class="col-md-9">
                            <div class="fileupload fileupload-new" data-provides="fileupload">
                                <div class="fileupload-new thumbnail" style="width: 200px; height: 150px;">
                                    <img src="{{ $advertisement->bannering->path or '' }}" alt="" />
                                </div>
                                <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
                                <div>
                                   <span class="btn btn-default btn-file" style="margin-left: 0px;">
                                       <span class="fileupload-new" style="margin-left: 0px;"><i class="fa fa-paper-clip"></i> 选择文件(尺寸:105*80px)</span>
                                       <span class="fileupload-exists" style="margin-left: 0px;"><i class="fa fa-undo"></i> 重选</span>
                                       <input type="file" name="banner" class="default" />
                                   </span>
                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload" style="margin-left: 0px;"><i class="fa fa-trash"></i> 移除</a>
                                </div>
                            </div>
                            <br/>
                            @if ($errors->has('banner'))
                                <label class="error">{{ $errors->first('banner') }}</label>
                            @endif
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-10">
                            <button class="btn btn-primary" type="submit">保存</button>
                        </div>
                    </div>
                </form>
            </div>

        </div>
    </section>
@endsection

@section('js')
    <script type="text/javascript">
        var ue = UE.getEditor('container');
        ue.ready();
    </script>
    <script type="text/javascript" src="{{ asset('files/js/bootstrap-fileupload.min.js') }}"></script>
@endsection